package ps.client.plugin.eq2.gui.dialog.chat;

import java.awt.BorderLayout;

import ps.client.gui.util.DialogEx;


@SuppressWarnings("serial")
public class SpinoffChatDialog extends DialogEx {
	
	ChatDialog chatSplitterDialog;
	ChatTextPanel chatTextPanel;
	
	public SpinoffChatDialog(ChatDialog chatSplitterDialog, ChatTextPanel chatTextPanel, String prefNode) {
		super(chatSplitterDialog.eq2Plugin.getMainFrame(), prefNode + "/" + chatTextPanel.getName());
		this.chatSplitterDialog = chatSplitterDialog;
		this.chatTextPanel = chatTextPanel;

		setTitle(chatTextPanel.getName());
		setAlwaysOnTop(true);
		
		getContentPane().setLayout(new BorderLayout());
		getContentPane().add(chatTextPanel, BorderLayout.CENTER);
	}
	
	public void hide() {
		if (isVisible()) {
		    chatSplitterDialog.restoreTab(chatTextPanel);
		}
		super.hide();
	}
}
